﻿namespace Site2AppWP8
{
    using System;
    using Microsoft.Phone.Controls;

    public static class WebBrowserExtensions
    {
        public static object TryToInvokeScript(this WebBrowser browser, string scriptName, params string[] args)
        {
            try
            {
                return browser.InvokeScript(scriptName, args);
            }
            catch (SystemException)
            {
            }

            return null;
        }

        public static object TryToRunScript(this WebBrowser browser, string args)
        {
            return browser.TryToInvokeScript("eval", args);
        }
    }
}
